package model.bean;

import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

@Entity
@Table(name = "v_turma")
public class Turma {

	@Id
	@Column(name = "id_turma")
	private Long id;
	@Column(name = "data_inicio")
	private Date dataInicio;
	@Column(name = "data_fim")
	private Date dataTermino;
	@Column(name = "num_alunos")
	private int numeroAlunos;
	@Column(name = "turno")
	private String turno;
	@Column(name = "finalizada")
	private boolean finalizada;

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "id_professor")
	@Fetch(FetchMode.SELECT)
	private Professor professor;

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "id_modulo")
	@Fetch(FetchMode.SELECT)
	private Modulo modulo;

	@OneToMany(mappedBy = "turma", fetch = FetchType.LAZY)
	private List<Matricula> matriculas;

	public Long getId() {
		return id;
	}

	public Date getDataInicio() {
		return dataInicio;
	}

	public Date getDataTermino() {
		return dataTermino;
	}

	public int getNumeroAlunos() {
		return numeroAlunos;
	}

	public String getTurno() {
		return turno;
	}

	public boolean isFinalizada() {
		return finalizada;
	}

	public Professor getProfessor() {
		return professor;
	}

	public Modulo getModulo() {
		return modulo;
	}

	public List<Matricula> getMatriculas() {
		return matriculas;
	}

	public void setId(Long id) {
		this.id = id;
	}
	
	

}
